//
//  HomeViewController.swift
//  LPZ-DYZB
//
//  Created by 刘培壮 on 2016/11/10.
//  Copyright © 2016年 刘培壮. All rights reserved.
//

import UIKit

private let kTitleViewHeight = 40 as CGFloat


class HomeViewController: UIViewController {

    fileprivate lazy var titleView: PageTitleView = {
        let frame = CGRect(x: 0, y: kNavigationHeight, width: kScreenWidth, height: kTitleViewHeight)
        let titles = ["推荐","游戏","娱乐","趣玩"]
        let titleView = PageTitleView(frame: frame, titles:titles)
        return titleView
    }()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        setUI()
        setUpNavigation()
    }
    
}

extension HomeViewController {
    
    fileprivate func setUI() {
        // 0.不需要调整UIScrollView的内边距
        automaticallyAdjustsScrollViewInsets = false
        view.addSubview(titleView)
    }
    
    fileprivate func setUpNavigation() {

        let leftItem = UIBarButtonItem(imageName: "logo")
        navigationItem.setLeftBarButton(leftItem, animated: true)
        
        let size = CGSize(width: 40, height: 40)
        let rightItem1 = UIBarButtonItem(imageName: "image_my_history", highlightedImageName: "Image_my_history_click", size: size)
        let rightItem2 = UIBarButtonItem(imageName: "Image_scan", highlightedImageName: "Image_scan_click", size: size)
        let rightItem3 = UIBarButtonItem(imageName: "btn_search", highlightedImageName: "btn_search_click", size: size)
        navigationItem.rightBarButtonItems = [rightItem1,rightItem2,rightItem3]
        
    }
}
